import 'package:flutter/material.dart';

import 'models/food.dart';

class FoodTile extends StatelessWidget {
  final Food food;
  final void Function()? onTop;
  const FoodTile({super.key, required this.food, this.onTop});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: onTop,
      child: Container(
        margin: EdgeInsets.only(right: 25),
        padding: EdgeInsets.all(25),
        decoration: BoxDecoration(
          color: Colors.grey[100],
          borderRadius: BorderRadius.circular(20),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            //image
            Image.asset(food.imagePath,height: 140,),
            //text
            Text(food.name,
              style: TextStyle(
                fontSize: 20.0,
                fontFamily: "Calibre-Semibold", ),),
            //price
            SizedBox(
              width: 160,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text('\$'+food.price,style: TextStyle(
                      fontWeight: FontWeight.bold,color: Colors.grey[700]
                  ),),
                  Row(
                    children: [
                      Icon(Icons.star ,color: Colors.yellow[800],),
                      Text(food.rating,
                        style: TextStyle(color: Colors.grey),),
                    ],
                  )
                ],
              ),
            )
            //rati
          ],
        ),
      ),
    );
  }
}
